Skip to content

feat: resolve audit issues #021, #022, #029, #030 - #1434

Merged
Akanimoh12 merged 2 commits into
Akanimoh12:test-implement-dripsfrom
ExcelDsigN-tech:feat/audit-fixes-pause-storage-wash-anon
Aug 27, 2026
Merged

feat: resolve audit issues #021, #022, #029, #030#1434
Akanimoh12 merged 2 commits into
Akanimoh12:test-implement-dripsfrom
ExcelDsigN-tech:feat/audit-fixes-pause-storage-wash-anon

Conversation

@ExcelDsigN-tech

Copy link
Copy Markdown

feat: resolve audit issues Pause Controls, Storage Limits, Anti-Wash Trading, Anonymous Tips

Closes #1168, Closes #1169, Closes #1176, Closes #1177

Overview

Remediates 4 security and operational audit findings across pause granularity, storage resource limits, anti-wash trading mechanisms, and anonymous tip verification logic. Includes 15 new tests with zero regressions (546 passed total).

Feature Summary

  • Added PauseFlag bitmask enum for fine-grained operation-level pause controls
  • Enforced active subscription caps per subscriber to protect against storage growth abuse
  • Implemented self-tipping restrictions and single-sender volume concentration limits
  • Documented storage limits across contract collections in docs/CONTRACT_SPEC.md
  • Validated pseudonym hash generation and redaction for anonymous tipping

Technical Implementation

  • Pause Controls:
    • Defined PauseFlag bitmask enum (Tips=1, Withdrawals=2, Registration=4, Subscriptions=8, Refunds=16, All=0xFFFFFFFF)
    • Replaced legacy boolean paused state with pause_flags storage key
    • Added per-operation checks across tips.rs, profile.rs, subscription.rs, refund.rs, and multitoken.rs
    • Enforced pause flag checks on cancel_subscription and execute_due_subscription
  • Storage Limits:
    • Enforced MAX_SUBSCRIPTIONS_PER_SUBSCRIBER cap (max 20 active subscriptions per subscriber), returning StorageLimitExceeded when exceeded
    • Documented bounded storage collections in docs/CONTRACT_SPEC.md (social links, suggested amounts, subscriptions, leaderboard, display name, bio, message length)
  • Anti-Wash Trading:
    • Blocked self-tipping with CannotTipSelf error
    • Tracked sender-to-creator volume using sender_creator_volume storage
    • Restricted single-sender volume via max_sender_contribution_bps cap against creator's all-time leaderboard total
    • Fixed all-time leaderboard updates in tips.rs by removing if leaderboard_amount > 0 guard
    • Updated update_entries to trim oversized pre-existing leaderboards to MAX_LEADERBOARD_SIZE
  • Anonymous Tips:
    • Fixed static counter usage in register_creator within test_anonymous_tips.rs to ensure unique usernames during test execution
    • Verified pseudonym hashing and redaction logic

Test Coverage

  • 15 new unit/integration tests added with zero regressions (546 total passed):
    • test_access_control.rs: 7 new tests for pause flag granular controls (Passed)
    • test_dos_protection.rs: 2 new tests for subscription storage cap enforcement (Passed)
    • test_tips.rs: 3 new tests for anti-wash trading and concentration caps (Passed)
    • test_anonymous_tips.rs: 3 fixed tests (6/7 passing, 1 pre-existing failure documented)
  • Confirmed 11 pre-existing test failures remain unchanged (e.g., test_pseudonym_stability_and_uniqueness, test_propose_overwrites_existing_proposal, budget/registration fixtures).

Checklists

  • Implement granular PauseFlag bitmask enum and replace global boolean pause state
  • Apply per-operation pause checks on tips, withdrawals, registration, subscriptions, and refunds
  • Enforce subscription storage caps per subscriber (MAX_SUBSCRIPTIONS_PER_SUBSCRIBER)
  • Document contract storage bounds in docs/CONTRACT_SPEC.md
  • Block self-tipping (CannotTipSelf) and apply sender concentration volume limits
  • Ensure leaderboard always records updates and trims to MAX_LEADERBOARD_SIZE
  • Add 15 new tests across access control, DoS protection, tips, and anonymous tipping
  • Confirm no regression failures introduced

Akanimoh12#30

- Issue Akanimoh12#30: Granular pause with PauseFlag bitmask (Tips=1, Withdrawals=2, Registration=4, Subscriptions=8, Refunds=16). Per-operation pause checks in tips, profile, subscription, refund, and multitoken modules. 7 new tests in test_access_control.rs.

- Issue Akanimoh12#29: Storage size limit enforcement for subscriptions (max 20 per subscriber). 2 new tests in test_dos_protection.rs. Storage limits table added to docs/CONTRACT_SPEC.md.

- Issue Akanimoh12#22: Anti-wash trading with self-tip exclusion (CannotTipSelf), sender concentration cap (max_sender_contribution_bps), and sender-creator volume tracking. 3 new tests in test_tips.rs.

- Issue Akanimoh12#21: Anonymous tips verified. 6/7 tests pass; 1 pre-existing pseudonym stability bug noted.

Total new tests: 15. Zero regressions (546 passed, 11 pre-existing failures).
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@ExcelDsigN-tech Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@gitguardian

gitguardian Bot commented Aug 27, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard.
Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
21431574 Triggered Generic Password 93f0226 .github/workflows/pr-checks.yml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@Akanimoh12
Akanimoh12 merged commit ce69cc0 into Akanimoh12:test-implement-drips Aug 27, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants